package com.mangaenglish.common.exception.handler;

import com.mangaenglish.common.exception.base.BaseException;
import com.mangaenglish.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created by Administrator on 2018/1/7 0007.
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value =  BaseException.class)
    public Result handler(BaseException ex){
       return Result.<String>createFail(BaseException.BASE_EXCEPTION, ex.getMessage());
    }

}
